#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>
int main (){
  int fd, fd2,numofreads;
 
  char buffer [100];
  fd = open ("random_text.txt", O_RDWR | O_CREAT,0777);
  fd2 = open ("modified_text.txt", O_RDWR | O_CREAT,0777);

  if(fd < 0 | fd2<0) {
       printf("error!\n");}
        
        

       int readcount = read(fd ,buffer,100);
       while (readcount>0){
           if(numofreads % 2 ==0){
               write (fd2,"even read!\n",10);
           }
           else {
               write(fd2,buffer,100);
               write(fd2,"\n",1);
                

           }
           numofreads++;
               readcount = read(fd ,buffer,100);

       }

    if(close(fd)<0 |close(fd2)<0){
        printf("error!\n");
        exit(1);}

        return 0 ;}
         
        




